import {request, handleFetchResultNotification, REQUEST_TYPE} from '../../utils';
import {formatMessage} from '../localize';
import stringify from 'Shared/utils/stringify';
const baseUrl = '/afterSales/api/v1';

const getDealersDesc = formatMessage({
    id: 'api.message.dutyUnit',
    defaultMessage: '查询责任单位'
});

export const getDutyUnitSimple = conditions => request(`${baseUrl}/dutyUnits/base/simple?${stringify(conditions)}`, null, null)
    .then(handleFetchResultNotification(REQUEST_TYPE.query, getDealersDesc));

export const getDutyUnits = conditions => request(`${baseUrl}/dutyUnits/base?${stringify(conditions)}`, null, null)
    .then(handleFetchResultNotification(REQUEST_TYPE.query, getDealersDesc));
